package com.yun.algorithmproblem.leetcode;

public class Leetcode1742 {

    public static void main(String[] args) {
        Leetcode1742 obj = new Leetcode1742();
        int lowLimit = 1, highLimit = 10;
        obj.countBalls(lowLimit, highLimit);
    }

    public int countBalls(int lowLimit, int highLimit) {
        int[] cnt = new int[45];
        for (int i = lowLimit; i <= highLimit; i++) {
            int temp = i;
            int sum = 0;
            while (temp != 0) {
                sum += temp % 10;
                temp /= 10;
            }
            cnt[sum - 1]++;
        }
        int max=0;
        for (int i : cnt) {
            max=Math.max(max,i);
        }
        return max;
    }
}
